home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / GNU / GNUPLOTsrc.lha / term / xlib.trm < prev   
Encoding:
Text File  |  1996-01-22  |  2.7 KB  |  123 lines

  1. /*
  2.  * $Id: xlib.trm,v 1.5 1995/12/20 21:48:22 drd Exp $
  3.  */
  4.  
  5.  
  6. /*
  7.  * xlib.trm - inboard terminal driver for X11 (dumps gnuplot_x11 commands)
  8.  *
  9.  * To be used with gnulib_x11.
  10.  */
  11.  
  12. /*
  13.  * adapted to new terminal layout by Stefan Bodewig (Dec. 1995)
  14.  */
  15.  
  16. #ifndef GOT_DRIVER_H
  17. #include "driver.h"
  18. #endif
  19.  
  20. #ifdef TERM_REGISTER
  21. register_term(xlib)
  22. #endif
  23.  
  24. #ifdef TERM_PROTO
  25. TERM_PUBLIC void Xlib_init __P((void));
  26. TERM_PUBLIC void Xlib_graphics __P((void));
  27. TERM_PUBLIC void Xlib_text __P((void));
  28. TERM_PUBLIC void Xlib_reset __P((void));
  29. TERM_PUBLIC void Xlib_move __P((unsigned int x, unsigned int y));
  30. TERM_PUBLIC void Xlib_vector __P((unsigned int x, unsigned int y));
  31. TERM_PUBLIC void Xlib_linetype __P((int lt));
  32. TERM_PUBLIC void Xlib_put_text __P((unsigned int x, unsigned int y, char str[]));
  33. TERM_PUBLIC int Xlib_justify_text __P((enum JUSTIFY mode));
  34.  
  35. #define Xlib_XMAX 4096
  36. #define Xlib_YMAX 4096
  37.  
  38. /* approximations for typical font/screen sizes */
  39. #define Xlib_VCHAR (Xlib_YMAX/25) 
  40. #define Xlib_HCHAR (Xlib_XMAX/100) 
  41. #define Xlib_VTIC (Xlib_YMAX/100)
  42. #define Xlib_HTIC (Xlib_XMAX/150)
  43.  
  44. #define GOT_XLIB_PROTO
  45. #endif
  46.  
  47. #ifndef TERM_PROTO_ONLY
  48. #ifdef TERM_BODY
  49.  
  50. TERM_PUBLIC void Xlib_init() { ; }
  51.  
  52. TERM_PUBLIC void Xlib_graphics() { fprintf(outfile, "G\n"); }
  53.  
  54. TERM_PUBLIC void Xlib_text()
  55.   fprintf(outfile, "E\n"); fflush(outfile);
  56. #ifdef ULTRIX_KLUDGE
  57.   fprintf(outfile, "E\n"); fflush(outfile);
  58. #endif
  59. }
  60.  
  61. TERM_PUBLIC void Xlib_reset() { fprintf(outfile, "R\n"); fflush(outfile); }
  62.  
  63. TERM_PUBLIC void Xlib_move(x,y)
  64.      unsigned int x,y;
  65. {
  66.   fprintf(outfile, "M%04d%04d\n", x, y);
  67. }
  68.  
  69. TERM_PUBLIC void Xlib_vector(x,y)
  70.      unsigned int x,y;
  71. {
  72.   fprintf(outfile, "V%04d%04d\n", x, y);
  73. }
  74.  
  75. TERM_PUBLIC void Xlib_linetype(lt)
  76.      int lt;
  77. {
  78.   fprintf(outfile, "L%04d\n", lt);
  79. }
  80.  
  81. TERM_PUBLIC void Xlib_put_text(x,y,str)
  82.      unsigned int x,y;
  83.      char str[];
  84. {
  85.   fprintf(outfile, "T%04d%04d%s\n", x, y, str);
  86. }
  87.  
  88. TERM_PUBLIC int Xlib_justify_text(mode)
  89.      enum JUSTIFY mode;
  90. {
  91.   fprintf(outfile, "J%04d\n", mode);
  92.   return(TRUE);
  93. }
  94.  
  95. #endif
  96.  
  97. #ifdef TERM_TABLE
  98. TERM_TABLE_START(xlib_driver)
  99.      "xlib", "X11 Window System (gnulib_x11 dump)",
  100.        Xlib_XMAX, Xlib_YMAX, Xlib_VCHAR, Xlib_HCHAR, 
  101.        Xlib_VTIC, Xlib_HTIC, options_null, Xlib_init, Xlib_reset, 
  102.        Xlib_text, null_scale, Xlib_graphics, Xlib_move, Xlib_vector, 
  103.        Xlib_linetype, Xlib_put_text, null_text_angle, 
  104.        Xlib_justify_text, line_and_point, do_arrow, set_font_null
  105. TERM_TABLE_END(xlib_driver)
  106. #undef LAST_TERM
  107. #define LAST_TERM xlib_driver
  108.  
  109. #endif /* TERM_TABLE */
  110. #endif /* TERM_PROTO_ONLY */
  111.  
  112. /*
  113.  * NAME: xlib
  114.  *
  115.  * OPTIONS: none
  116.  *
  117.  * SUPPORTS: X11 Window System
  118.  *
  119.  * Further Info: dumps gnulib_x11 commands. term x11 is the same as 
  120.  *         set term xlib; set out "|gnuplot_x11".
  121.  *
  122.  */